package uk.co.q3c.deplan.google;

import java.util.TreeSet;

import javax.persistence.Id;

import com.googlecode.objectify.annotation.Cached;
import com.googlecode.objectify.annotation.Unindexed;

@Unindexed
@Cached(expirationSeconds = 600)
public class TreeSetUser {

	@Id
	private Long id;
	private TreeSet<TreeSetEntry> treeset;

	public TreeSetUser() {
		super();
	}

	public TreeSet<TreeSetEntry> getTreeset() {
		return treeset();
	}

	public Long getId() {
		return id;
	}

	public void add(TreeSetEntry tse) {
		treeset().add(tse);

	}

	private TreeSet<TreeSetEntry> treeset() {
		if (treeset == null) {
			treeset = new TreeSet<TreeSetEntry>();
		}
		return treeset;
	}

	public TreeSetEntry getFloor(TreeSetEntry e) {
		return treeset().floor(e);
	}

}
